---
category: Number
created: '2020-05-05'
title: Calculate the remainder of division of arguments
updated: '2021-10-13'
---

**JavaScript version**

```js remainder.js
const remainder = (...args) => args.reduce((a, b) => a % b);
```

**TypeScript version**

```ts remainder.ts
const remainder = (...args: number[]): number => args.reduce((a, b) => a % b);
```

**Examples**

```js examples.js
remainder(1, 2, 3, 4); // 1
```
